import {reactive} from "vue";
import {processRequest} from "@/framework";

export const useReflectionData = () => {

    const reflections = reactive<{
        commentList: any[]
        userList: any[]
    }>({
        commentList: [],
        userList: []
    })


    async function getDepartmentList(params?: any) {
        const result = await processRequest.get("/api/BlogText",
            {
                pageIndex: 1,
                pageSize: 99999999,
                ...params
            })
        reflections.commentList = result.dataList
    }

    async function getUserList(params?: any) {
        const result = await processRequest.get("/api/BlogUser",
            {
                pageIndex: 1,
                pageSize: 99999999,
                ...params
            })
        reflections.userList = result.dataList
    }


    async function getReflectionData() {
        getDepartmentList()
        getUserList()
    }

    return {
        getDepartmentList,
        reflections,
        getReflectionData
    }
}
